package org.dromara.job.snailjob;

import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
import com.aizuda.snailjob.client.model.ExecuteResult;
import com.aizuda.snailjob.common.core.util.JsonUtil;
import com.aizuda.snailjob.common.log.SnailJobLog;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.tearoom.api.RemoteMqttService;
import org.springframework.stereotype.Component;


@Component
@JobExecutor(name = "cleanIotLogJobExecutor")
public class CleanIotLogJobExecutor {
    @DubboReference
    RemoteMqttService remoteMqttService;

    public ExecuteResult jobExecute(JobArgs jobArgs) {
        remoteMqttService.cleanDeviceLog();
        SnailJobLog.LOCAL.info("CleanIotLogJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
        SnailJobLog.REMOTE.info("CleanIotLogJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
        return ExecuteResult.success("清除日志成功");
    }


}
